﻿{template 'header', $module}
<div class="menu">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="tab" id="add"><a href="spread.php?action=add"><span>Buy Rank</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="s3"><a href="spread.php"><span>Has passed<span class="px10">({$nums[3]})</span></span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="s2"><a href="spread.php?status=2"><span>Audit<span class="px10">({$nums[2]})</span></span></a></td>
</tr>
</table>
</div>
{if $action == 'add'}
<form method="post" action="spread.php" onsubmit="return check();">
<input type="hidden" name="mid" value="{$mid}"/>
<input type="hidden" name="kw" value="{$kw}"/>
<input type="hidden" name="action" value="{$action}"/>
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl">Type：</td>
<td class="tr"><a href="{$MODULE[$mid][linkurl]}" class="t">{$MODULE[$mid][name]}Rank</a></td>
</tr>
<tr>
<td class="tl">Keyword：</td>
<td class="tr"><strong>{$kw}</strong></td>
</tr>
<tr>
<td class="tl">From：</td>
<td class="tr f_red f_b">{$price}{$unit}</td>
</tr>
<tr>
<td class="tl">Markups：</td>
<td class="tr f_b">{if $step}{$step}{$unit}{else}Any{/if}</td>
</tr>
<tr>
<td class="tl">Bid：</td>
<td class="tr"><input type="text" name="buy_price" value="{$price}" size="10" id="price" onkeyup="CA();"/></td>
</tr>
<tr>
<td class="tl">Long time of purchase：</td>
<td class="tr">
<select name="buy_month" id="month" onchange="CA();">
{php for($i=1;$i<=$month;$i++){}
<option value="{$i}">{$i}Month</option>
{php }}
</select>
</td>
</tr>
<tr>
<td class="tl">Information ID：</td>
<td class="tr">
<input type="text" name="buy_tid" value="{if $mid==4}{$_userid}{/if}" size="10" id="key_id" onfocus="select_item({$mid}, 'member');"/> <a href="javascript:select_item({$mid}, 'member');" class="t">Choose..</a>  <span id="dkey_id" class="f_red"></span>
</td>
</tr>
<tr>
<td class="tl">Total price payable：</td>
<td class="tr f_red f_b" id="payment">{$price}{$unit}</td>
</tr>
{if $currency == 'money'}
<tr>
<td class="tl">{$DT[money_name]}Balance：</td>
<td class="tr"><span class="f_blue f_b">{$_money}{$unit}</span>&nbsp;&nbsp;<a href="charge.php?action=pay" target="_blank" class="t">[Recharge]</a></td>
</tr>
<tr>
<td class="tl">Payment password：</td>
<td class="tr">{template 'password', 'chip'}</td>
</tr>
{else}
<tr>
<td class="tl">{$DT[credit_name]}Balance：</td>
<td class="tr"><span class="f_blue f_b">{$_credit}{$unit}</span>&nbsp;&nbsp;<a href="credit.php?action=buy" target="_blank" class="t">[Buy]</a></td>
</tr>
{/if}
<tr>
<td class="tl"> </td>
<td class="tr"><input type="submit" name="submit" value="Determining the purchase" class="btn"/>&nbsp;
<input type="button" value="Reselect" class="btn" onclick="Go('{$EXT[spread_url]}');"/>
</td>
</tr>
</table>
</form>

<script type="text/javascript">
function CA() {
	if(Dd('price').value.match(/^[0-9]{1,}$/)) {
		Dd('payment').innerHTML = Dd('price').value*Dd('month').value + '{$unit}';
	} else {
		Dd('price').value = '{$price}';
	}
}
function check() {
	var p = Dd('price').value;
	if(p < {$price}) {
		alert('Offer can not be lower than from');
		Dd('price').focus();
		return false;
	}
	if((p-{$price})%{$step} != 0) {
		alert('Please click markups increases');
		Dd('price').focus();
		return false;
	}
	{if $currency == 'money'}
	if(p*Dd('month').value > {$_money}) {
		alert('Account balance is insufficient, please recharge');
		return false;
	}
	{else}
	if(p*Dd('month').value > {$_credit}) {
		alert('Your {$DT[credit_name]} insufficient, please buy');
		return false;
	}
	{/if}
	if(Dd('key_id').value.length < 1) {
		alert('Please fill out the information ID');
		Dd('key_id').focus();
		return false;
	}
	{if $currency == 'money'}
	if(Dd('password').value.length < 6) {
		alert('Please fill out the payment password');
		Dd('password').focus();
		return false;
	}
	{/if}
}
</script>

<script type="text/javascript">s('spread');m('add');</script>
{else}
<div class="ls">
<table cellpadding="0" cellspacing="0" class="tb">
<tr>
<th>Keyword</th>
<th>Module</th>
<th>Bid</th>
<th>Unit</th>
<th>Start Date</th>
<th>End Date</th>
<th>Remaining (days)</th>
<th>Delivery Status</th>
<th>Application Period</th>
<th>Information</th>
</tr>
{loop $lists $k $v}
<tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center">
<td><a href="{$EXT[spread_url]}{rewrite('index.php?kw='.urlencode($v['word']))}" target="_blank" class="b">{$v[word]}</a></td>
<td><a href="{$MODULE[$v[mid]][linkurl]}{rewrite('search.php?kw='.urlencode($v['word']))}" target="_blank" class="b" rel="nofollow">{$MODULE[$v[mid]][name]}</a></td>
<td>{$v[price]}</td>
<td>{if $v[currency]=='money'}{$DT[money_unit]}{else}{$DT[credit_unit]}{/if}</td>
<td>{timetodate($v[fromtime], 3)}</td>
<td>{timetodate($v[totime], 3)}</td>
<td{if $v[days]<5} class="f_red"{/if}>{$v[days]}</td>
<td>{$v[process]}</td>
<td class="f_gray px11">{timetodate($v[addtime], 5)}</td>
<td><a href="{$MODULE[3][linkurl]}redirect.php?mid={$v[mid]}&itemid={$v[tid]}" target="_blank" class="b">直达</a></td>
</tr>
{/loop}
</table>
</div>
<div class="pages">{$pages}</div>
<script type="text/javascript">s('spread');m('s{$status}');</script>
{/if}
{template 'footer', $module}